package com.qt.bilibili.sort;

public class Demo01 {

    public static void main(String[] args) {

        int[] a = {1,5,3,2,4};


        xzSort(a);


    }

    public static void xzSort(int[] arr){
        //决定循环几层
        for (int i = 0; i < arr.length - 1; i++) {
            for(int j = i;j < arr.length - 1;j++){
                if(arr[j] > arr[j+1]){
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
}
